import java.util.Locale;
//判断是不是回文字符串
public class Repeat {
    private static boolean isValidChar(char ch) {
        if(Character.isDigit(ch) || Character.isLetter(ch)) {
            return true;
        }
        return false;
    }
    public static boolean repeat(String s) {
        String str = s.toLowerCase();
        System.out.println(str);//看一下大写字母转小写字母成功了吗
        int left = 0;
        int right = str.length() - 1;
        while (left < right) {


            while (left < right) {
                left++;
            }
            while (left < right && isValidChar(s.charAt(right))) {
                right--;
            }
            if (str.charAt(left) == str.charAt(right)) {
                return true;
            }
        }
        return false;
    }
    public static void main(String[] args) {
        String s = "BCDEDCB";
        System.out.println(s);//输出看一下大写字母
        boolean ret =Repeat.repeat(s);
        System.out.println(ret);//输出字符串是不是回文的
    }
}
